<!DOCTYPE html>
<html>

{include file='public/header'}

<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="javascript:void(0)">首页</a>
            <a href="javascript:void(0)">投放管理</a>
            <a><cite>抖音撮合合作商和达人号</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">
        <form class="layui-form layui-row" style="margin-top:15px;margin-bottom: 10px;">
            <div class="layui-inline">
                <label class="layui-form-label w-auto">名称：</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" placeholder="请输入名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline" style="margin-left:10px">
                <button class="layui-btn" lay-submit lay-filter="searchList">搜索</button>
                <button type="reset" id="resetList" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </form>

        <table id="getClientList" lay-filter="getClientList"></table>
    </div>
    <script type="text/html" id="toolbar">
        <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm" lay-event="add">添加</button>
        </div>
    </script>
    <script type="text/html" id="tbBar">
        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script>
        let params = {
            elem: '#getClientList'
            , toolbar: '#toolbar'
            , url: '/admin/tiktok/getClientList' //数据接口
            , id: 'getClientList'
            , limit:15
            , page:true
            , cols: [[ //表头
                { field: 'id', title: 'ID', align:'center'}
                , { field: 'name', title: '名称', align:'center'}
                , { field: 'dy_key', title: '撮合商或者达人key', align:'center'}
                , {title: '类型',align:'center', templet: function (d) {
                        if (d.type == 1) {
                            return '撮合中介';
                        } else if (d.type == 2) {
                            return '主播抖音号';
                        } else if (d.type == 3) {
                            return '第三方小程序';
                        }
                    },
                }
                , { toolbar: '#tbBar', title: '操作', width: 150, align:'center' }
            ]]
        }
        tableList(params)

        layui.use('table', function () {
            var table = layui.table;
            table.on('toolbar(getClientList)', function (obj) {
                var event = obj.event;
                if (event === 'add') {
                    x_admin_show('添加', './dyClietInfo.html', 650, 450);
                }
            });
            table.on('tool(getClientList)', function (obj) {
                var event = obj.event;
                if (event === 'del') {
                    DeleteAjax('/admin/tiktok/delClient',{ id: obj.data.id,status:2 },'getClientList')
                } else if (event === 'edit') {
                    x_admin_show('编辑', `./dyClietInfo.html?id=${obj.data.id}`, 650, 450);
                }
            });

        });

    </script>
</body>

</html>